#include "widget.h"
#include "ui_widget.h"

#include<QPainter>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::paintEvent(QPaintEvent *event)
{

    QPainter painter(this);

    QPixmap pixmap(":/a.jpg");

    //基础绘制
//    painter.drawPixmap(10,10,pixmap);


    //图片缩放
//    painter.drawPixmap(100,100,400,300,pixmap);

    //图片旋转,本质上吧Qpainter对象进行了旋转，绘制的内容也进行了旋转
    painter.rotate(180);
    painter.translate(-800,-600);
    painter.drawPixmap(100,100,400,300,pixmap);


}


